//
//  ActivityButton.m
//  SchoolCircle
//
//  Created by 战立军 on 16/6/1.
//  Copyright © 2016年 战立军. All rights reserved.
//

#import "ActivityButton.h"

#define kImageWH 30

@implementation ActivityButton

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self.titleLabel setTextAlignment:NSTextAlignmentCenter];
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    return self;
}
- (void)setImage:(UIImage *)image andTitle:(NSString *)title
{
    [self setImage:image forState:UIControlStateNormal];
    [self setTitle:title forState:UIControlStateNormal];
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    return CGRectMake((self.bounds.size.width-kImageWH)/2, 0, kImageWH, kImageWH);
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    return CGRectMake(0, kImageWH, self.bounds.size.width, self.bounds.size.height-kImageWH);
}

@end
